package count.negative.gerti4;

import android.app.Activity;
import android.os.Bundle;
import android.text.format.DateFormat;
import android.view.View;
import android.webkit.WebView;
import android.widget.TextView;
import count.negative.gerti4.service.ProgramService;

public class AbendActivity extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		final ProgramService ps = ((GertiActivity) getParent()).ps;

		final WebView browser = new WebView(this);
		browser.setPadding(0, 0, 0, 0);
		browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
		setContentView(browser);
		browser.getSettings().setDefaultTextEncodingName("utf-8");
		final String html = ps.getAbendHTML();
		if (html != null) {
			browser.loadDataWithBaseURL("", html, "text/html", "utf-8", "");
		}
		browser.setClickable(false);

		TextView dateView = (TextView) getParent().findViewById(R.id.dateTextView);
		dateView.setText(DateFormat.format("EEEE, dd. MMMM yyyy", ps.getDateOfData()));
	}
}